# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.OAuth2.V2.Model.Userinfo do
  @moduledoc """


  ## Attributes

  *   `email` (*type:* `String.t`, *default:* `nil`) - The user's email address.
  *   `family_name` (*type:* `String.t`, *default:* `nil`) - The user's last name.
  *   `gender` (*type:* `String.t`, *default:* `nil`) - The user's gender.
  *   `given_name` (*type:* `String.t`, *default:* `nil`) - The user's first name.
  *   `hd` (*type:* `String.t`, *default:* `nil`) - The hosted domain e.g. example.com if the user is Google apps user.
  *   `id` (*type:* `String.t`, *default:* `nil`) - The obfuscated ID of the user.
  *   `link` (*type:* `String.t`, *default:* `nil`) - URL of the profile page.
  *   `locale` (*type:* `String.t`, *default:* `nil`) - The user's preferred locale.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The user's full name.
  *   `picture` (*type:* `String.t`, *default:* `nil`) - URL of the user's picture image.
  *   `verified_email` (*type:* `boolean()`, *default:* `true`) - Boolean flag which is true if the email address is verified. Always verified because we only return the user's primary email address.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :email => String.t(),
          :family_name => String.t(),
          :gender => String.t(),
          :given_name => String.t(),
          :hd => String.t(),
          :id => String.t(),
          :link => String.t(),
          :locale => String.t(),
          :name => String.t(),
          :picture => String.t(),
          :verified_email => boolean()
        }

  field(:email)
  field(:family_name)
  field(:gender)
  field(:given_name)
  field(:hd)
  field(:id)
  field(:link)
  field(:locale)
  field(:name)
  field(:picture)
  field(:verified_email)
end

defimpl Poison.Decoder, for: GoogleApi.OAuth2.V2.Model.Userinfo do
  def decode(value, options) do
    GoogleApi.OAuth2.V2.Model.Userinfo.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.OAuth2.V2.Model.Userinfo do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
